package ufc.sd.util;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import ufc.sd.dao.DatabaseUtil;

public class InitApplicationListener implements ServletContextListener {

	@Override
	public void contextDestroyed(ServletContextEvent event) {

	}

	@Override
	public void contextInitialized(ServletContextEvent event) {
		boolean clearDatabase = "true".equalsIgnoreCase(event.getServletContext().getInitParameter("DATABASE_CLEAR_ON_INIT"));
		DatabaseUtil.initDatabase(clearDatabase);
	}
}
